<template>
    <div>
        <nav>
            <span @click="goHome" class="fa fa-angle-left"></span>
            <span>生活分享</span>
            <span>发布</span>
        </nav>
         <main>
      <textarea name id="message">分享生活的美好,记录生命的点点滴滴</textarea>
    </main>
    <footer>
        
        <!-- 可见范围 -->
        <div class="comment comment-two">
            <div>
                <span>可见范围</span>
            </div>
            <div @click="openPublic">
                <span>公开</span> &#x2000;
                <span class="fa fa-angle-right"></span>&#x2000;
            </div>
            
        </div>
        <div>
            <div style=" text-align: left;margin-top:3vw;">
                <span class="imgTop">
                    长按图片可以拖动更换位置或者删除~
                </span>
            </div>
            <!-- 选择图片 -->
            <div @click="imgeShow" class="imgContent">
                <span>+</span>
            </div>
        </div>
        <!-- 公开 -->
        <popup :show-mask='true' v-model="isShow" position='bottom' :popup-style="{zIndex:900}">
         <div class="add">
             <ul>
                 <li>公开</li>
                 <li>秘密</li>
                 <li class="cancel" @click="cancel">取消</li>
             </ul>
         </div>
        </popup>
        <!-- 私密 -->
        <popup  v-model="ImgShow" position='bottom' :popup-style="{zIndex:999}">
         <div class="add">
             <ul>
                 <li>拍一张</li>
                 <li>从相册中选取</li>
                 <li class="cancel" @click="cancel">取消</li>
             </ul>
         </div>
        </popup>
    </footer>

    <transition v-show="isShowConfirm" name="confirm-fade">
    <div v-if="isShowConfirm" class="my-confirm" @click.stop="clickFun('clickCancel')">
      <div class="confirm-content-wrap" @click.stop>
        <h3 class="my-confirm-title">{{ titleText }}</h3>
        <p class="my-confirm-content">{{ content }}</p>
        <div class="my-operation">
          <div v-if="type==='confirm'" class="my-cancel-btn" @click="clickFun('clickCancel')">
            <p class="my-btn-text my-border-right">{{ cancelText }}</p>
          </div>
          <div class="confirm-btn" @click="clickFun('clickConfirm')">
            <p class="my-btn-text">{{ confirmText }}</p>
          </div>
        </div>
      </div>
    </div>
  </transition>
    </div>
</template>

<script>
import { Confirm,Popup,ConfirmPlugin,Actionsheet } from 'vux'
export default {
    data() {
        return {
               isShow:false,
        ImgShow:false,

        isShowConfirm: false, 
        titleText:'温馨提示',
        content:'是否要放弃本次操作',
        cancelText:'取消',
        confirmText:'放弃',
        type:'confirm',
        outerData:null
        }
    },
    components: {
       Confirm,
       Popup,
       ConfirmPlugin,
       Actionsheet,
       
  },
  methods: {
    goHome: function() {
        this.isShowConfirm = true
    //   window.location.href = "/";
    },
    openPublic:function() {
      this.isShow = !this.isShow
    },
    cancel:function() {
        this.isShow = false
        this.ImgShow = false
    },
    imgeShow:function() {
        this.ImgShow = !this.ImgShow
    },
    defaultMessage:function() {
        this.isShow = true
    },
    show(content,config){
        this.content = content || '是否要放弃本次操作'

        if(Object.prototype.toString.call(config) === '[object Object]'){
            this.titleText = config.titleText || '温馨提示'
            this.cancelText = config.cancelText || '取消'
            this.confirmText = config.confirmText || '放弃'
            this.type = config.type || 'confirm'
            this.outerData = config.data || null
        }
        this.isShowConfirm = true
    },
    hidden() {
        this.isShowConfirm = false
        this.titleText = '温馨提示'
        this.cancelText = '取消'
        this.confirmText = '放弃'
        this.type = 'confirm'
        this.outerData = null
    },
    clickFun (type) {
      this.$emit('userBehavior', type, this.outerData)
      this.hidden()
      window.location.href ='/'
    }
  }
}
</script>

<style scoped>
      nav{
  width: 100vw;
  height: 10vw;
  background:#09bb07;
  color: white;
  font-size: 5vw;
  line-height: 12vw;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
main {
  width: 100vw;
 
}
#message {
  width: 100vw;
  height: 25vw;
  color: gray;
  font-size: 4vw;
  overflow: auto;
  background-attachment: fixed;
  background-repeat: no-repeat;
  border-style: solid;
border: none;
  border-color: #ffffff;
}
footer{
    margin-top: -1vw;
    width: 100vw;
    height: 141vw;
    background-color: white;
}
.comment{
    height: 13vw;
    width: 100vw;
    display: flex;
    border-top: 1px solid gray;
    border-bottom: 1.5px solid #3333;
    justify-content: space-between;
    line-height: 13vw;

}
.comment-two{
    border-top: none;
}
.imgTop{
    color: gray;
    font-size: 3vw;
}
.add{
    width: 100vw;
    height: 30vw;
}
li{
     width: 100vw;
    height: 10vw;
    color: #09bb07;
    line-height: 10vw;
}
.cancel {
    color: gray;
}
.imgContent{
    margin-top: 3vw;
    width: 20vw;
    height: 20vw;
    border: 1px dashed gray;
    background-color: #3333;
}
.imgContent > span {
    display: inline-block;
    width: 10vw;
    height: 10vw;
    font-size: 16vw;
    color: gray;
}


.my-confirm {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    /* 这里防止当用户长按屏幕，出现的黑色背景色块，以及 iPhone 横平时字体的缩放问题 */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  } /* 进入和出去的动画 */ .confirm-fade-enter-active {
    animation: opacity 0.3s;
  } .confirm-fade-enter-active .confirm-content-wrap {
    animation: scale 0.3s;
  } .confirm-fade-leave-active {
    animation: outOpacity 0.2s;
  } /* 包裹层容器样式 */ .confirm-content-wrap {
    position: absolute;
    top: 28%;
    left: 0;
    right: 0;
    width: 280px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 5px;
    z-index: 999;
    user-select: none;
  } /* 顶部标题部分 */ .my-confirm-title {
    padding-top: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 500;
    color: #333;
  } /* 中间内容部分 */ .my-confirm-content {
    padding: 0 15px;
    padding-top: 20px;
    margin-bottom: 32px;
    text-align: center;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
  } /* 底部按钮样式 */ .my-operation {
    display: flex;
    border-top: 1px solid #eee;
  } .my-operation .my-cancel-btn, .confirm-btn {
    flex: 1;
  } .my-operation .confirm-btn {
    color: #ffb000;
  } .my-operation .my-btn-text {
    text-align: center;
    font-size: 16px;
    margin: 14px 0;
    padding: 6px 0;
  } /* 其他修饰样式 */ .my-border-right {
    border-right: 1px solid #eee;
  } /* 进来的动画 */ @keyframes opacity { 0% {
      opacity: 0;
    } 100% {
      opacity: 1;
    } } @keyframes scale { 0% {
      transform: scale(0);
    } 60% {
      transform: scale(1.1);
    } 100% {
      transform: scale(1);
    } } /* 出去的动画 */ @keyframes outOpacity { 0% {
      opacity: 1;
    } 100% {
      opacity: 0;
    } }
</style>
